﻿//创建人：蒋金金
//创建时间：2017年2月17日 15点15分
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BI.CF.IDAL;
using BI.CF.Factory;
using BI.CF.Model;
using System.Data.SqlClient;
using BI.CF.PageList;
namespace BI.CF.BLL
{
    public  class MemLoanBLL
    {
        static CF_Factory fac = CF_Factory.DataBaseType();
        MemLoanIDAL servicefac = fac.MemLoanFactry();
        /// <summary>
        /// 显示信用标
        /// </summary>
        /// <param name="pageindex">当前第几页页</param>
        /// <param name="pagesize">当前页显示几条数据</param>
        /// <returns></returns>
        public SqlDataReader Show_MemlLoan(int pageindex, int pagesize, string UserName, decimal money, string fuhao)
        {
            return servicefac.Show_MemlLoan(pageindex,pagesize,UserName,money,fuhao);
        } 


        /// <summary>
        /// 返回信用标的显示
        /// </summary>
        /// <param name="UserName">用户名</param>
        /// <param name="LoanMoney">金额</param>
        /// <param name="BiJiaoFuHao">比较符号</param>
        /// <returns></returns>
        public int Count_MemLoan(string UserName, decimal LoanMoney, string BiJiaoFuHao)
        {
            return servicefac.Count_MemLoan(UserName, LoanMoney, BiJiaoFuHao);
        }
        /// <summary>
        /// 成功案例展示
        /// </summary>
        /// <returns></returns>
        public Pager<MemLoanModel> Get_MemLoan_Selet(string RepaymentModeId, string ExamineState, int PageIndex, int PageSize)
        {
            return servicefac.Get_MemLoan_Selet(RepaymentModeId,ExamineState,PageIndex,PageSize); 
        }
        
        /// <summary>
        /// 根据ID查询具体案例信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public MemLoanModel Get_MemLoanOne(string id)
        {
            return servicefac.Get_MemLoanOne(id); 
        }
        /// <summary>
        /// 发布借款信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int MemLoanAdd(MemLoanModel model)
        {
            return servicefac.MemLoanAdd(model);
        }
        /// <summary>
        /// 查询支付密码
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public UserrsModel SelectPayPwd(int id)
        {
            return servicefac.SelectPayPwd(id);
        }
        /// <summary>
        /// 修改支付密码
        /// </summary>
        /// <param name="id"></param>
        /// <param name="pwd"></param>
        /// <returns></returns>
        public bool UpdatePwd(int id, string pwd)
        {
            return servicefac.UpdatePwd(id, pwd);
        }

        /// <summary>
        /// 显示所有的借款信息
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <param name="Title"></param>
        /// <param name="MinTime"></param>
        /// <param name="MaxTime"></param>
        /// <param name="State"></param>
        /// <param name="Userid"></param>
        /// <returns></returns>
        public Pager<MemLoanModel> SelectMomLoanMone(int pageSize, int pageIndex, string Title, string MinTime, string MaxTime, string State, int Userid)
        {
            return servicefac.SelectMomLoanMone(pageSize, pageIndex, Title, MinTime, MaxTime, State, Userid);
        }
        /// <summary>
        /// 修改审核状态
        /// </summary>
        /// <param name="id"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public bool UpdateMemloanState(int id, int state)
        {
            return servicefac.UpdateMemloanState(id, state);
        }
        #region 查询待还记录
        /// <summary>
        /// 查询待还记录
        /// </summary>
        /// <param name="id">借款编号</param>
        /// <returns></returns>
        public List<RepayDetailedModel> GetOne_Rep(int id)
        {
            #region 查询待还记录
            return servicefac.GetOne_Rep(id);
            #endregion
        }
        #endregion
    }
}
